
function on_submit(){
	if(usernameOnblur() && pwdOnblur() && regpwdOnblur() && phoneOnblur()){
		alert('注册成功！');
		return true;
	}else{
		alert('请按提示输入正确信息！');
		return  false;
	}
}
// 用户名 失去焦点
function usernameOnblur(){
    var name= document.myForm.username.value;
    document.getElementById('yz1').style.color="red";
    if(name.length !=0 ){
        if(name.length >= 6 && name.length<=12){
            document.getElementById('yz1').style.color = 'green';
            document.getElementById('yz1').innerHTML="√";
			return true;
        }else{
            document.getElementById('yz1').innerHTML="用户名由6到12个字符组成";
			return false;
        }        
    }else{
        document.getElementById('yz1').innerHTML="用户名不能为空";
		return false;
    }       
}
// 密码 失去焦点
function pwdOnblur(){
    var pwd = document.myForm.pwd.value;
    document.getElementById('yz2').style.color="red";
    if(pwd.length !=0 ){
        if(pwd.length >= 8 && pwd.length<=16){
            document.getElementById('yz2').style.color = 'green';
            document.getElementById('yz2').innerHTML="√";
			return true;
        }else{
            document.getElementById('yz2').innerHTML="密码长度为8-16位";
			return false;
        }        
    }else{
        document.getElementById('yz2').innerHTML="密码不能为空";
		return false;
    }       
}

// 确认密码 失去焦点
function regpwdOnblur(){
    var pwd = document.myForm.pwd.value;
    var regpwd = document.myForm.regpwd.value;
    document.getElementById('yz3').style.color="red";
    if(regpwd.length !=0 ){
        if(regpwd == pwd){
            document.getElementById('yz3').style.color = 'green';
            document.getElementById('yz3').innerHTML="√";
			return true;
        }else{
            document.getElementById('yz3').innerHTML="两次密码不一样";
			return false;
        }
    }else{
        document.getElementById('yz3').innerHTML="密码不能为空";
		return false;
    }    
}

// 手机号失去焦点
function phoneOnblur(){
    var phone = document.myForm.phone.value;
    document.getElementById('yz4').style.color="red";
    var myreg = /^[1][3,4,5,7,8,9][0-9]{9}$/;
    if(phone.length !=0 ){
        if (!myreg.test(phone)) {
            document.getElementById('yz4').innerHTML="手机号格式不正确";
        } else {
            document.getElementById('yz4').style.color = 'green';
            document.getElementById('yz4').innerHTML="√";
			return true;
        }
    }else{
        document.getElementById('yz4').innerHTML="手机号不能为空";
		return false;
    }     
}
